package com.woniu.user.mapper;

import com.woniu.common.entity.Dog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author author
 * @create 2021/5/19
 */
@Mapper
public interface PetMapper {
    //查看宠物信息
    @Select("select * from dog where u_id = #{u_id}")
    List<Dog> selectDogByUserid(Integer id);
    //设置宠物电子犬证
    @Update("update dog set dogetc_image = #{dogetc_image} where u_id = #{u_id}")
    boolean addetcImage(Dog dog);
    //查找宠物犬牌信息
    @Select("select id, dogetc_image from dog where u_id = #{u_id}")
    List<Dog> selectdogetc_image(Integer u_id);
    @Select("select * from dog d,user u where d.u_id=u.id and u.name=#{name} and " +
            "u.icd=#{icd} and u.tel=#{tel} and d.dogetc=#{dogetc}")
    Dog selectDog(@Param("name")String name,@Param("icd")String icd,@Param("tel")String tel,
                  @Param("dogetc")String dogetc);
}
